<?php
class Mivec_Element_String extends Mivec_Element_Abstract
{
	protected $_str;
	protected $_separator;

	public function __construct($str)
	{
		$this->_str = $str;
		self::_init();
		return $this;
	}
	
	public function _init()
	{
		$this->_separator = array(',','.',"\r","|","<br>");
		return $this;
	}
	
	public function toArray($separator=',')	
	{
		$_split = split($separator,$this->_str);
		if ($_split) {
			foreach ($_split as $_s) {
				if ($_s != '') {
					$arr[] = $_s;
				}
			}
			return $arr;
		}
	}
	
	public function generationRound()
	{
		$_arr = self::toArray();
		for(;$_arr[0] <= $_arr[1];$_arr[0]++) {
			$arr[] = $_arr[0];
		}
		return $arr;
	}
	
	public function replace(array $from,$to='')
	{
		if ($from) {
			$this->_str = str_replace($from,$to,$this->_str);
		}
		return $this;
	}
	
	public function get()
	{
		return $this->_str;
	}
}